import React from 'react' 
import {NavBar} from 'antd-mobile'
import {withRouter} from 'react-router-dom'
import PropTypes from 'prop-types'
import './index.scss'
import styles from './index.module.css'

class NavHeader extends React.Component {
  static propTypes = {
    children: PropTypes.string.isRequired
  }

  render() {
    return (
      <NavBar
        mode="light"
        id={styles.navBar}
        icon={<i className="icon-back iconfont" />}
        onLeftClick={() => this.props.history.go(-1)}
      >
        {this.props.children}
      </NavBar>
    )
  }
}

export default withRouter(NavHeader)
